<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Tacopie: tacopie::tcp_socket Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="tacopie_logo.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Tacopie
   &#160;<span id="projectnumber">3.0.0</span>
   </div>
   <div id="projectbrief">Tacopie is a TCP Client &amp; Server C++11 library.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>tacopie</b></li><li class="navelem"><a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classtacopie_1_1tcp__socket-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">tacopie::tcp_socket Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="tcp__socket_8hpp_source.html">tcp_socket.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:ad8376e85df96ab9523f5d079ed7172ab"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#ad8376e85df96ab9523f5d079ed7172ab">type</a> { <b>CLIENT</b>, 
<b>SERVER</b>, 
<b>UNKNOWN</b>
 }</td></tr>
<tr class="separator:ad8376e85df96ab9523f5d079ed7172ab"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a88ed1cadb0263591c4d31805e0a1a001"><td class="memItemLeft" align="right" valign="top"><a id="a88ed1cadb0263591c4d31805e0a1a001"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a88ed1cadb0263591c4d31805e0a1a001">tcp_socket</a> (void)</td></tr>
<tr class="memdesc:a88ed1cadb0263591c4d31805e0a1a001"><td class="mdescLeft">&#160;</td><td class="mdescRight">ctor <br /></td></tr>
<tr class="separator:a88ed1cadb0263591c4d31805e0a1a001"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4bd737a76a2a326be03d704f79a35282"><td class="memItemLeft" align="right" valign="top"><a id="a4bd737a76a2a326be03d704f79a35282"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a4bd737a76a2a326be03d704f79a35282">~tcp_socket</a> (void)=default</td></tr>
<tr class="memdesc:a4bd737a76a2a326be03d704f79a35282"><td class="mdescLeft">&#160;</td><td class="mdescRight">dtor <br /></td></tr>
<tr class="separator:a4bd737a76a2a326be03d704f79a35282"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a191ffa48e0753ad4ec87d4d3a4a97822"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a191ffa48e0753ad4ec87d4d3a4a97822">tcp_socket</a> (fd_t fd, const std::string &amp;host, std::uint32_t port, <a class="el" href="classtacopie_1_1tcp__socket.html#ad8376e85df96ab9523f5d079ed7172ab">type</a> t)</td></tr>
<tr class="separator:a191ffa48e0753ad4ec87d4d3a4a97822"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a64f69cd1c185b523b543d4ea53cee1a2"><td class="memItemLeft" align="right" valign="top"><a id="a64f69cd1c185b523b543d4ea53cee1a2"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a64f69cd1c185b523b543d4ea53cee1a2">tcp_socket</a> (<a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> &amp;&amp;)</td></tr>
<tr class="memdesc:a64f69cd1c185b523b543d4ea53cee1a2"><td class="mdescLeft">&#160;</td><td class="mdescRight">move ctor <br /></td></tr>
<tr class="separator:a64f69cd1c185b523b543d4ea53cee1a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5ae1a5b0f9713ef256164afdbeb1c193"><td class="memItemLeft" align="right" valign="top"><a id="a5ae1a5b0f9713ef256164afdbeb1c193"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a5ae1a5b0f9713ef256164afdbeb1c193">tcp_socket</a> (const <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> &amp;)=delete</td></tr>
<tr class="memdesc:a5ae1a5b0f9713ef256164afdbeb1c193"><td class="mdescLeft">&#160;</td><td class="mdescRight">copy ctor <br /></td></tr>
<tr class="separator:a5ae1a5b0f9713ef256164afdbeb1c193"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aae3234c92bd36d5a614e44472d42bbf4"><td class="memItemLeft" align="right" valign="top"><a id="aae3234c92bd36d5a614e44472d42bbf4"></a>
<a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#aae3234c92bd36d5a614e44472d42bbf4">operator=</a> (const <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> &amp;)=delete</td></tr>
<tr class="memdesc:aae3234c92bd36d5a614e44472d42bbf4"><td class="mdescLeft">&#160;</td><td class="mdescRight">assignment operator <br /></td></tr>
<tr class="separator:aae3234c92bd36d5a614e44472d42bbf4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a69fde61058ab72d88ce48f557d8216cf"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a69fde61058ab72d88ce48f557d8216cf">operator==</a> (const <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> &amp;rhs) const</td></tr>
<tr class="separator:a69fde61058ab72d88ce48f557d8216cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a76f69612969374b5aa542378d37ee398"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a76f69612969374b5aa542378d37ee398">operator!=</a> (const <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> &amp;rhs) const</td></tr>
<tr class="separator:a76f69612969374b5aa542378d37ee398"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0d6d30258a902d12b3c2c62644756685"><td class="memItemLeft" align="right" valign="top">std::vector&lt; char &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a0d6d30258a902d12b3c2c62644756685">recv</a> (std::size_t size_to_read)</td></tr>
<tr class="separator:a0d6d30258a902d12b3c2c62644756685"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a36521a8f502adc665ad0fb1c53583d04"><td class="memItemLeft" align="right" valign="top">std::size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a36521a8f502adc665ad0fb1c53583d04">send</a> (const std::vector&lt; char &gt; &amp;data, std::size_t size_to_write)</td></tr>
<tr class="separator:a36521a8f502adc665ad0fb1c53583d04"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6748c78312763dca6b8be05c4c8c3419"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a6748c78312763dca6b8be05c4c8c3419">connect</a> (const std::string &amp;host, std::uint32_t port, std::uint32_t timeout_msecs=0)</td></tr>
<tr class="separator:a6748c78312763dca6b8be05c4c8c3419"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a910a183d7c45483f1cdacd10a1896155"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a910a183d7c45483f1cdacd10a1896155">bind</a> (const std::string &amp;host, std::uint32_t port)</td></tr>
<tr class="separator:a910a183d7c45483f1cdacd10a1896155"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af0957ded2a84fb06d940cba98df477fb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#af0957ded2a84fb06d940cba98df477fb">listen</a> (std::size_t max_connection_queue)</td></tr>
<tr class="separator:af0957ded2a84fb06d940cba98df477fb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af5113c9332f83643cdaaf15c3f137760"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#af5113c9332f83643cdaaf15c3f137760">accept</a> (void)</td></tr>
<tr class="separator:af5113c9332f83643cdaaf15c3f137760"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad5a30b17b1dad9f0ff40305e246a9213"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#ad5a30b17b1dad9f0ff40305e246a9213">close</a> (void)</td></tr>
<tr class="separator:ad5a30b17b1dad9f0ff40305e246a9213"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad294565f9a0fa52639ecfbf133eecd59"><td class="memItemLeft" align="right" valign="top">const std::string &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#ad294565f9a0fa52639ecfbf133eecd59">get_host</a> (void) const</td></tr>
<tr class="separator:ad294565f9a0fa52639ecfbf133eecd59"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5276fdc687ac3c5089a05e3e2d9de4fb"><td class="memItemLeft" align="right" valign="top">std::uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a5276fdc687ac3c5089a05e3e2d9de4fb">get_port</a> (void) const</td></tr>
<tr class="separator:a5276fdc687ac3c5089a05e3e2d9de4fb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f663be51b845520505bc20a88b411ee"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classtacopie_1_1tcp__socket.html#ad8376e85df96ab9523f5d079ed7172ab">type</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a4f663be51b845520505bc20a88b411ee">get_type</a> (void) const</td></tr>
<tr class="separator:a4f663be51b845520505bc20a88b411ee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a89be86ab254eec3fc16eedfba8b16fb2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a89be86ab254eec3fc16eedfba8b16fb2">set_type</a> (<a class="el" href="classtacopie_1_1tcp__socket.html#ad8376e85df96ab9523f5d079ed7172ab">type</a> t)</td></tr>
<tr class="separator:a89be86ab254eec3fc16eedfba8b16fb2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4fd367a1802ed6ae7fa0e33fc07ed255"><td class="memItemLeft" align="right" valign="top">fd_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a4fd367a1802ed6ae7fa0e33fc07ed255">get_fd</a> (void) const</td></tr>
<tr class="separator:a4fd367a1802ed6ae7fa0e33fc07ed255"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d9933c767572b03fbb4b5ced4bd1fc4"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classtacopie_1_1tcp__socket.html#a6d9933c767572b03fbb4b5ced4bd1fc4">is_ipv6</a> (void) const</td></tr>
<tr class="separator:a6d9933c767572b03fbb4b5ced4bd1fc4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classtacopie_1_1tcp__socket.html">tacopie::tcp_socket</a> is the class providing low-level TCP socket features. The <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> provides a simple but convenient abstraction to unix and windows sockets. It also provides a socket type checker to ensure that server-only operations are only processable on server sockets, and client-only operations are only processable on client sockets. </p>
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a id="ad8376e85df96ab9523f5d079ed7172ab"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad8376e85df96ab9523f5d079ed7172ab">&#9670;&nbsp;</a></span>type</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classtacopie_1_1tcp__socket.html#ad8376e85df96ab9523f5d079ed7172ab">tacopie::tcp_socket::type</a></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">strong</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>possible types of a TCP socket, either a client or a server type is used to prevent the used of client specific operations on a server socket (and vice-versa)</p>
<p>UNKNOWN is used when socket type could not be determined for now </p>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a191ffa48e0753ad4ec87d4d3a4a97822"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a191ffa48e0753ad4ec87d4d3a4a97822">&#9670;&nbsp;</a></span>tcp_socket()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">tacopie::tcp_socket::tcp_socket </td>
          <td>(</td>
          <td class="paramtype">fd_t&#160;</td>
          <td class="paramname"><em>fd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>host</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::uint32_t&#160;</td>
          <td class="paramname"><em>port</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classtacopie_1_1tcp__socket.html#ad8376e85df96ab9523f5d079ed7172ab">type</a>&#160;</td>
          <td class="paramname"><em>t</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>custom ctor build socket from existing file descriptor</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fd</td><td>fd of the raw socket that will be used to init the <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> object </td></tr>
    <tr><td class="paramname">host</td><td>host associated to the socket </td></tr>
    <tr><td class="paramname">port</td><td>port associated to the socket </td></tr>
    <tr><td class="paramname">t</td><td>type of the socket (client or server) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="af5113c9332f83643cdaaf15c3f137760"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af5113c9332f83643cdaaf15c3f137760">&#9670;&nbsp;</a></span>accept()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> tacopie::tcp_socket::accept </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Accept a new incoming connection. The socket must be of type server to process this operation. If the type of the socket is unknown, the socket type will be set to server.</p>
<dl class="section return"><dt>Returns</dt><dd>Return the <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> associated to the newly accepted connection. </dd></dl>

</div>
</div>
<a id="a910a183d7c45483f1cdacd10a1896155"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a910a183d7c45483f1cdacd10a1896155">&#9670;&nbsp;</a></span>bind()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void tacopie::tcp_socket::bind </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>host</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::uint32_t&#160;</td>
          <td class="paramname"><em>port</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Binds the socket to the given host and port. The socket must be of type server to process this operation. If the type of the socket is unknown, the socket type will be set to server.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">host</td><td>Hostname to be bind to </td></tr>
    <tr><td class="paramname">port</td><td>Port to be bind to </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ad5a30b17b1dad9f0ff40305e246a9213"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad5a30b17b1dad9f0ff40305e246a9213">&#9670;&nbsp;</a></span>close()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void tacopie::tcp_socket::close </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Close the underlying socket. </p>

</div>
</div>
<a id="a6748c78312763dca6b8be05c4c8c3419"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6748c78312763dca6b8be05c4c8c3419">&#9670;&nbsp;</a></span>connect()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void tacopie::tcp_socket::connect </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>host</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::uint32_t&#160;</td>
          <td class="paramname"><em>port</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::uint32_t&#160;</td>
          <td class="paramname"><em>timeout_msecs</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Connect the socket to the remote server. The socket must be of type client to process this operation. If the type of the socket is unknown, the socket type will be set to client.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">host</td><td>Hostname of the target server </td></tr>
    <tr><td class="paramname">port</td><td>Port of the target server </td></tr>
    <tr><td class="paramname">timeout_msecs</td><td>maximum time to connect (will block until connect succeed or timeout expire). 0 will block undefinitely. If timeout expires, connection fails </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a4fd367a1802ed6ae7fa0e33fc07ed255"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4fd367a1802ed6ae7fa0e33fc07ed255">&#9670;&nbsp;</a></span>get_fd()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">fd_t tacopie::tcp_socket::get_fd </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>direct access to the underlying fd</p>
<dl class="section return"><dt>Returns</dt><dd>underlying socket fd </dd></dl>

</div>
</div>
<a id="ad294565f9a0fa52639ecfbf133eecd59"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad294565f9a0fa52639ecfbf133eecd59">&#9670;&nbsp;</a></span>get_host()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const std::string&amp; tacopie::tcp_socket::get_host </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>the hostname associated with the underlying socket. </dd></dl>

</div>
</div>
<a id="a5276fdc687ac3c5089a05e3e2d9de4fb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5276fdc687ac3c5089a05e3e2d9de4fb">&#9670;&nbsp;</a></span>get_port()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::uint32_t tacopie::tcp_socket::get_port </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>the port associated with the underlying socket. </dd></dl>

</div>
</div>
<a id="a4f663be51b845520505bc20a88b411ee"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4f663be51b845520505bc20a88b411ee">&#9670;&nbsp;</a></span>get_type()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classtacopie_1_1tcp__socket.html#ad8376e85df96ab9523f5d079ed7172ab">type</a> tacopie::tcp_socket::get_type </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>the type associated with the underlying socket. </dd></dl>

</div>
</div>
<a id="a6d9933c767572b03fbb4b5ced4bd1fc4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6d9933c767572b03fbb4b5ced4bd1fc4">&#9670;&nbsp;</a></span>is_ipv6()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool tacopie::tcp_socket::is_ipv6 </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>whether the host is IPV6 </dd></dl>

</div>
</div>
<a id="af0957ded2a84fb06d940cba98df477fb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af0957ded2a84fb06d940cba98df477fb">&#9670;&nbsp;</a></span>listen()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void tacopie::tcp_socket::listen </td>
          <td>(</td>
          <td class="paramtype">std::size_t&#160;</td>
          <td class="paramname"><em>max_connection_queue</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Make the socket listen for incoming connections. Socket must be of type server to process this operation. If the type of the socket is unknown, the socket type will be set to server.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">max_connection_queue</td><td>Size of the queue for incoming connections to be processed by the server </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a76f69612969374b5aa542378d37ee398"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a76f69612969374b5aa542378d37ee398">&#9670;&nbsp;</a></span>operator!=()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool tacopie::tcp_socket::operator!= </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> &amp;&#160;</td>
          <td class="paramname"><em>rhs</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>comparison operator</p>
<dl class="section return"><dt>Returns</dt><dd>true when the underlying sockets are different (different file descriptor or socket type). </dd></dl>

</div>
</div>
<a id="a69fde61058ab72d88ce48f557d8216cf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a69fde61058ab72d88ce48f557d8216cf">&#9670;&nbsp;</a></span>operator==()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool tacopie::tcp_socket::operator== </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> &amp;&#160;</td>
          <td class="paramname"><em>rhs</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>comparison operator</p>
<dl class="section return"><dt>Returns</dt><dd>true when the underlying sockets are the same (same file descriptor and socket type). </dd></dl>

</div>
</div>
<a id="a0d6d30258a902d12b3c2c62644756685"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d6d30258a902d12b3c2c62644756685">&#9670;&nbsp;</a></span>recv()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;char&gt; tacopie::tcp_socket::recv </td>
          <td>(</td>
          <td class="paramtype">std::size_t&#160;</td>
          <td class="paramname"><em>size_to_read</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Read data synchronously from the underlying socket. The socket must be of type client to process this operation. If the type of the socket is unknown, the socket type will be set to client.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size_to_read</td><td>Number of bytes to read (might read less than requested) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the read bytes </dd></dl>

</div>
</div>
<a id="a36521a8f502adc665ad0fb1c53583d04"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a36521a8f502adc665ad0fb1c53583d04">&#9670;&nbsp;</a></span>send()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::size_t tacopie::tcp_socket::send </td>
          <td>(</td>
          <td class="paramtype">const std::vector&lt; char &gt; &amp;&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::size_t&#160;</td>
          <td class="paramname"><em>size_to_write</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Send data synchronously to the underlying socket. The socket must be of type client to process this operation. If the type of the socket is unknown, the socket type will be set to client.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>Buffer containing bytes to be written </td></tr>
    <tr><td class="paramname">size_to_write</td><td>Number of bytes to send </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns the number of bytes that were effectively sent. </dd></dl>

</div>
</div>
<a id="a89be86ab254eec3fc16eedfba8b16fb2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a89be86ab254eec3fc16eedfba8b16fb2">&#9670;&nbsp;</a></span>set_type()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void tacopie::tcp_socket::set_type </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classtacopie_1_1tcp__socket.html#ad8376e85df96ab9523f5d079ed7172ab">type</a>&#160;</td>
          <td class="paramname"><em>t</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>set type, should be used if some operations determining socket type have been done on the behalf of the <a class="el" href="classtacopie_1_1tcp__socket.html">tcp_socket</a> instance</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">t</td><td>type of the socket </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>includes/tacopie/network/<a class="el" href="tcp__socket_8hpp_source.html">tcp_socket.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
